home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
science
/
sm32a.zip
/
LIBRARY
/
FITPLOT.LI2
< prev
next >
Wrap
Text File
|
1994-07-20
|
690b
|
25 lines
# library fitplot.li
# fitplot()
# fits and plots data ( [x1,x2,...], [y1,y2,...] ) with a linear line
# e.g. fitplot([1,2,3,4], [1,2.2,2.8,4])
fitplot(x_, y_) := block(numeric:=on,
graph,
xmax:=max(x)*1.05,
xmin:=min(x)*0.9,
ymax:=max(y)*1.05,
ymin:=min(y)*0.9,
dx:=(xmax-xmin)/getmaxx,
dy:=(ymax-ymin)/getmaxy,
length:=length(y),
axis(xmin,xmax,ymin,ymax),
do( circle((member(x,j)-xmin)/dx,getmaxy-(member(y,j)-ymin)/dy,2),
j,1,length,1),
setcolor(colorno(yellow)),
line((member(x,1)-xmin)/dx,getmaxy-(member(y,1)-ymin)/dy,
(member(x,length)-xmin)/dx,getmaxy-(member(y,length)-ymin)/dy),
numeric:=off,
readchar,
text,
local(dx,dy,length))